#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QVector>
#include <QColor>

#include "WidWav/comtraderecord.h"
#include "qcustomplot/qcustomplot.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_btn_filechoice_clicked();

    void on_btn_amp_clicked();

    void on_btn_red_clicked();

    void on_btn_reset_clicked();

    void on_btn_clear_clicked();

    void plot_clicked(QMouseEvent *event);

protected:
//    void mousePressEvent(QMouseEvent *event);
//    void mouseReleaseEvent(QMouseEvent *event);
//    void mouseMoveEvent(QMouseEvent *event);
//    void paintEvent(QPaintEvent *);


private:
    Ui::MainWindow *ui;

    ComtradeRecord *m_comtrade;

    //曲线图画布
    QVector<QCustomPlot *> m_cust_plot;
    //X轴时间标记
    QVector<double> m_timeBaseus;
    //每个通道的值
    QVector<QVector<double>> m_data;
    //左侧提示信息
    QVector<QLabel*> m_label_s;
    //通道颜色
    QMap<QString, QColor> m_color;


    //曲线窗口默认高度
    int m_min_heght = 100;
    int m_min_now = m_min_heght;

    bool m_is_init;
    void add_analogChannel_chart(int index);
    int get_index(double data);

    void button_enable(void);
    void button_disenable(void);
};

#endif // MAINWINDOW_H
